package core

import (
	abci "github.com/tendermint/tendermint/abci/types"
	ctypes "github.com/tendermint/tendermint/rpc/core/types"
	rpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
)

func BuildIndex(ctx *rpctypes.Context, fileType, fileCategory string) (*ctypes.ResultBuildIndex, error) {
	res, err := env.ProxyAppQuery.BuildIndex(abci.RequestBuildIndex{
		FileType:     fileType,
		FileCategory: fileCategory,
	})
	if err != nil {
		return nil, err
	}

	return &ctypes.ResultBuildIndex{Response: *res}, nil
}
